import { Injectable } from '@angular/core';

import { CategoryName } from './pipes/categoryNamePipe';

@Injectable()
export class AppSettings {
  constructor(private categoryName: CategoryName) {}

  public static API_ENDPOINT = 'http://127.0.0.1:6666/api/';

  roleNavList: any = [];

  roleNavInit(user) {
    let info = user.activeVersionInfo;

    this.roleNavList.length = 0;

    this.roleNavList.push({
      path: '/dashborad',
      name: '行业分析',
      icon: 'fa-signal'
    });
    this.roleNavList.push({
      path: '/monitorBrand',
      name: '品牌数据',
      icon: 'fa-flag'
    });
    this.roleNavList.push({
      path: '/monitorShop',
      name: '店铺监控',
      icon: 'fa-home'
    });

    this.roleNavList.push({
      path: '/monitorProduct',
      name: '商品监控',
      icon: 'fa-shopping-bag'
    });

    this.roleNavList.push({ path: '/word', name: '最鲜商机', icon: 'fa-tags' });
    // this.roleNavList.push({ "path": "/product", "name": "商品数据", "icon": "fa-shopping-bag" });
    // this.roleNavList.push({ "path": "/shop", "name": "店铺数据", "icon": "fa-home" });

    // console.log(this.roleNavList);
  }
  // 用户权限
  getRoleNavList() {
    return this.roleNavList;
  }

  // 日销，月销
  public sellTime = {
    type: 'day',
    value: '日销'
  };

  setSellTime(timeType) {
    Object.assign(this.sellTime, timeType);
  }

  getSellTimeType() {
    return this.sellTime.type;
  }

  // 用户类目
  public cat = {
    catName: '', //catName == "/"?"全类目":catName,
    wholeName: '', //catName == ""?"":catName,
    categoryId: '' //this.user.activeVersionInfo.category
  };

  // 设置用户类目
  setAppCat(cat) {
    Object.assign(this.cat, cat);
  }
  // 获取用户类目
  getAppCat() {
    return this.cat;
  }
}
